/**
 * 
 */
package com.lunevich.layoutanimation;

import com.nineoldandroids.animation.AnimatorSet;
import com.nineoldandroids.animation.ObjectAnimator;

import android.content.Context;
import android.util.Log;
import android.widget.Button;

/**
 * @author andrey_lunevich
 *
 */
public class CustomButton extends Button {

	private final int ADD_DURATION = 1000;
	
	public CustomButton(Context context) {
		super(context);
	}
	
	@Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        
        AnimatorSet set = new AnimatorSet();
        set.playTogether( 
        		ObjectAnimator.ofFloat(this, "scaleX", 0, 1, 1.3f, 1)
        );
        set.setDuration(ADD_DURATION).start();
	}

	@Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        Log.d("Remove from window", "REMOVE FROM WINDOW");
	}
}